home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / unarced / datacomm / ncomm / host / host.script < prev    next >
Text File  |  1995-03-17  |  39KB  |  1,149 lines

  1. ;*******************************************************
  2. ; NComm HOST SYSTEM
  3. ; Version se below
  4. ;
  5. ; Copyright © 1989 Daniel Bloch ( ->Ver 1.3)
  6. ; Copyright © 1990 Nils-Arne Dahlberg
  7. ;                FREEWARE!!!!
  8. ;*******************************************************
  9. ; revision history
  10. ; by 1.6 these things are added:
  11. ;       Search for menus, bulletins and messages in separate directories
  12. ;       Private messages for all users
  13. ;    1.7
  14. ;       Private user passwords
  15. ;    1.8
  16. ;       Double menus
  17. ;    1.9
  18. ;       More messages areas
  19. ;    1.91
  20. ;       Packing and download of messages
  21. ;    1.92
  22. ;       UL/DL check
  23. ;    1.93
  24. ;       Remote Backup
  25. ;       Cosysop enabeld
  26. ;    1.94
  27. ;       Using extended hayes setup (all reset z0 gives right setup)
  28. ;    1.95
  29. ;       Removed part of page routine..
  30. ;    1.96
  31. ;       Changes in file menu
  32. ;    1.97
  33. ;       Changes in messages menus
  34. ;       Local mode
  35. ;    1.98
  36. ;       Cleanup, changing sysop/cosysop versions
  37. ;    1.99
  38. ;       Change of dos-commands in SYsop menu
  39. ;       change of sysop password placement
  40. ;    2.00
  41. ;       Changed placement of U/D load credits
  42. ;    2.01
  43. ;       Fixed a bug in placement of $name"DL" files
  44. ;       Added Possibility to grab bulletins
  45. ;       Added "waiting " at up/download
  46. ;    2.02
  47. ;       Changed packing program to variable, use what you want as sysop
  48. ;       'Return' leaves password change.
  49. ;    2.03
  50. ;       Just a bugfix
  51. ;    2.04
  52. ;       Changed timout command to make a 300 s timeout for logon as well
  53. ;    2.05
  54. ;       Made a small change to shorten the file
  55. ;    2.06
  56. ;       Added features: filetransfer with Ymodem-Batch and Ymodem-G
  57. ;       Print version number from main menu
  58. ;    2.07
  59. ;       A special reboot, or break facility included, I might take this
  60. ;       into an later E-script
  61. ;    2.08
  62. ;       Changed for an error when HOLD-directory is missing, this
  63. ;       directory might be missing due to the fact that BU-progs not
  64. ;       allways copies empty directories
  65. ;   2.09
  66. ;       Changed password routine to not accept nil password
  67. ;   2.10
  68. ;       YABH (Yet Another Bug-Hunt...)
  69. ;       Missed two \" in delete comment part...
  70. ;       Added Start Script in Sysop mode....
  71. ;       removed a IF $ -line, line no 680 somewhere....
  72. ;   2.10E
  73. ;       Back in english, again...
  74. ;   2.11E
  75. ;       Some small special features
  76. ;       A user questionare is added, upload for just some users,
  77. ;       a bug in login-sequense is corrected.
  78. ;       The messages editing is made in ram: now
  79.  
  80. SET     $version= "2.11Enad, 901101"
  81.  
  82. ;--------------------------------------------
  83. ; Set these variables to fit your needs
  84. ;--------------------------------------------
  85.         SET     $dir    = "NComm:host/"         ;Directory for misc. files
  86.                                                 ;base of all other
  87.         SET     $menudir = $dir"menus/"         ;menus here
  88.         SET     $bulldir = $dir"bulletins/"     ;bulletins here
  89.         SET     $msgsdir = $dir"msgs/"          ;messages here
  90.         SET     $userdir = $dir"Users/"         ;heres the users
  91.         SET     $userqst = $dir"UserQst/"       ;answers to questionare
  92.         SET     $uldir  = $dir"files/"          ;Upload directory
  93.         SET     $dldir  = $dir"files/"          ;Download directory
  94.         SET     $hold   = $dir"hold/"    ;Hold directory
  95.         SET     $apack   = "c:LHARC a "  ;packing command
  96.         SET     $alist   = "c:LHARC l "  ;listing command
  97.         SET     $aextract ="c:LHarc x "  ;extract command
  98.         SET     $arch    = ".lzh"               ;archive extension
  99.         SET     $holdzoo = $dir"files/HOLD"$arch        ;Hold file
  100.         SET     $tmp    = $dir"files/NHS.tmp"   ;Temporary file
  101.         SET     $UlDldir = $dir"fileCredit/"            ;Up & Downloaded files
  102.         SET     $sysop  = $dir"Sysop/"          ;Sysop directory
  103.         SET     $cosysop = $dir"CoSysop/"       ;coSysop directory
  104.         SET     $sysname = "Boringtown BBS"     ;Name of system
  105.         SET     $list   = "C:list"              ;Directory lister
  106.         SET     $MaxBaud = "2400"               ;Modems Maximum Baud
  107.         SET     $doscomm = $dir"Ckomm/"         ;dos commands for remote
  108.         SET     $hostMNPARQ = "FALSE"           ;set to false if not using
  109.                                                 ;a MNP or ARQ modem
  110.  
  111. ;All files in hold directory will be deleted at initialization!!!
  112.  
  113. ;-------------------- M A I N   P R O G R A M -----------------------;
  114.         message "\f"            ;Clear screen
  115. main:   clrstack
  116.         gosub   init            ;Initialize various stuff
  117.         gosub   connect         ;Wait for RING and answer the phone
  118.         timeout 300 goto bibi   ;must have it here i think..
  119.         when    "\r\nNO CARRIER\r\n" goto NoCarrier
  120.         gosub   prelog          ;Show opening picture
  121.         gosub   login           ;Get name & password
  122.         timeout 300 goto bibi   ;must have it here i think..
  123.         IF      exists $sysop$name THEN goto SysopLogin
  124.         IF      !EXISTS $cosysop$name then goto user
  125. SysopLogin:
  126.         SET     $sysacc = "TRUE"
  127.         IF      !EXISTS $cosysop$name then goto realsysop
  128.         SET     $cosys = "TRUE"
  129.         IF      EXISTS $cosysop$name$pass THEN goto OK
  130.         gosub   logout
  131.         goto    main
  132. RealSysop:
  133.         IF      exists $sysop$name$pass THEN goto OK
  134.         send    "Wrong!!\n"
  135.         write   $dir"log" "\n"$date"  Wrong SYSOP password: "$pass"\n"
  136.         gosub   logout
  137.         goto    main
  138. user:   SET     $sysacc = "FALSE"
  139.         IF      !EXISTS $userdir$name THEN goto NTry
  140.         IF      EXISTS $userdir$name$pass THEN goto OK
  141.         send    "Wrong!\n"
  142. NTry:
  143.         write   $dir"log" "\n"$date"  "$name"  Wrong password: "$pass"\n"
  144.         gosub   login
  145.         IF      !EXISTS $userdir$name THEN goto WrngName
  146.         IF      EXISTS $userdir$name$pass THEN goto OK
  147. WrngName:
  148.         send    "Wrong!!\n"
  149.         write   $dir"log" "\n"$date"  "$name"  Wrong password: "$pass"\n"
  150.         gosub   logout
  151.         goto    main
  152.  
  153. ;User has logged in
  154. OK:     write   $dir"log" "\n"$date"  Login: "$name" ("$baud")\n"
  155.         send    "\n\nYour last logon was:\n"
  156.         ascsend $userdir$name$pass
  157.         CLI     "delete >nil: \""$userdir$name$pass"\""
  158.         write   $userdir$name$pass $date"\n"
  159.         gosub   postlog
  160.         timeout 2
  161.         echo    off
  162.         send    "^[[97x"
  163.         input   $id "\r"
  164.         timeout 300 goto bibi   ;must have it here i think..
  165.         echo    on
  166.         send    "\nPress [ENTER] to continue..."
  167.         input   $dummy "\r"
  168.         send    "\f"
  169.         IF      !EXISTS $msgsdir$name then goto OK1
  170.         Send    "\n\nYou have messages waiting.\n"
  171.         send    "==========================\n\n"
  172. OK1:    ascsend $menudir".menu0"
  173.  
  174. ;This is the main loop
  175. loop:   gosub   MainMenu
  176.         send    "Are you sure you want to log off (Enter=Y)? "
  177.         input   $cmd "\r"
  178.         IF $cmd == "N" THEN goto loop
  179.         send    "\n"
  180.         gosub   logout
  181.         goto    main
  182.  
  183.  
  184.  
  185.  
  186. ;--------------------- S U B R O U T I N E S ----------------------
  187.  
  188.  
  189. ;********************************************************
  190. ;* Initialize the system
  191. ;********************************************************
  192. init:   config  $dir"host.config"
  193.         hangup
  194.         converse "OK" "\w\w\w+++\w\w\w\wATZ\n" ;Reset to saved default
  195.         converse "OK" "\w\w\w+++\w\w\w\wATX4V1M0\n" ;
  196.         converse "OK" "\w\w\wATS7=60\n" ;Wait one full minute for carrier
  197.         wait    "OK"
  198.         SET     $sysacc = "FALSE"
  199.         SET     $cosys = "FALSE"
  200.         echo    off
  201.         dwhens
  202.         timeout 0
  203.         CLI     "delete >nil: "$hold"#?"
  204.         write   $hold$sysname $sysname"\n Is running on version "$version"\n"
  205.         return
  206.  
  207.  
  208. ;********************************************************
  209. ;* Wait for CONNECT
  210. ;********************************************************
  211. connect:
  212.         dwhens
  213.         send    " \r"
  214.         gosub   skip
  215. conn0:  SET     $Local = "FALSE"
  216.         message "\n\n\n"$sysname"   [Press '?' for help]\n"
  217.         message "Waiting on call...\n"
  218. ConnW:  timeout 300 Goto DoExitQ        ; just wait for 5 minutes
  219.         input   $char ""        ;Get one character
  220.         timeout 90 goto noconnect
  221.         IF !$char == "?" THEN goto conn1
  222.         message "\n\nSpace = Local logon (turn the modem off first!)\n"
  223.         goto    conn0
  224. conn1:  IF $char == " " THEN goto Local
  225.         IF $char == "R" Then goto Local2
  226. conn2:
  227.         when    "CONNECT 1200" goto conn1200
  228.         when    "CONNECT 2400" goto conn2400
  229.         when    "CONNECT 4800" goto conn4800
  230.         when    "CONNECT 9600" goto conn9600
  231.         dtenths 7
  232.         SET     $baud = $MaxBaud
  233.         send    "\n\w\wAT\w\wA\n"
  234.         timeout 90 goto noconnect
  235.         wait    "NO CARRIER"
  236. NoConnect:
  237.         write   $dir"log" "\n\n"$date"  Login Failed\n\n"
  238.         gosub   init
  239.         goto connect
  240.  
  241. conn3:  dwhens
  242.         timeout 300 goto bibi
  243.         echo    on
  244.         gosub   skip
  245.         return
  246.  
  247. Local:  message "\nStarting local logon..."
  248.         SET     $baud = "19200"
  249.         SET     $Local = "TRUE"
  250.         goto    conn3
  251.  
  252. Local2: message "\nStarting local/remote logon.."
  253.         SET     $baud = "19200"
  254.         goto    conn3
  255.  
  256. QuitNHS:
  257.         config  "NComm:NComm.config"
  258.         end
  259.  
  260. conn1200:
  261.         SET     $baud = "1200"
  262.         goto    conn3
  263. conn2400:
  264.         SET     $baud = "2400"
  265.         goto    conn3
  266. conn4800:
  267.         SET     $baud = "4800"
  268.         goto    conn3
  269. conn9600:
  270.         SET     $baud = "9600"
  271.         goto    conn3
  272. ;**************************************************************************
  273. ; Check if another program wants NHS to quit.
  274. ; In that case, a file named NHSQUIT shuld be placed in the RAM:C directory
  275. ; you should also let the startup-sequence place DELETE there
  276. ; The place of the file may be changed.
  277. ; The Script tells it is quiting by removing this file
  278. ;***************************************************************************
  279. DoExitQ:
  280.         IF !EXISTS "RAM:C/NHSQUIT" THEN goto ConnW
  281.         Hangup  ; shouldn't be neccesary
  282.         CLI "RAM:C/DELETE RAM:C/NHSQUIT"
  283.         QUIT
  284.         END
  285.  
  286. ;********************************************************
  287. ;* Show "prelog", i.e. the picture to be shown before
  288. ;* login.
  289. ;********************************************************
  290. prelog: send    "\f"$sysname" ("$baud") up on "$date"\n"
  291.         send    $NComm" / NComm Host System (NHS) v"$version"\n"
  292.         send    "Copyright (c) 1989 Daniel Bloch (-> ver 1.3)\n"
  293.         send    "Copyright (c) 1990 Nils-Arne Dahlberg\n\n"
  294.         ascsend $dir"prelog"
  295.         return
  296.  
  297.  
  298. ;********************************************************
  299. ;* Show "postlog", i.e. the picture to be shown after
  300. ;* login.
  301. ;********************************************************
  302. postlog:
  303.         send    "\n\n"
  304.         ascsend $dir"postlog"
  305. ;       CLI     "cookie"
  306.         return
  307.  
  308.  
  309. ;********************************************************
  310. ;* Read user name and password into the variables
  311. ;* $name and $pass.
  312. ;********************************************************
  313. Login:  echo    on
  314.         timeout 120 goto LogSleep
  315.         send    "\n\nYour name: "
  316.         input   $name "\r"
  317.         IF      $name == "new" then goto NewUser
  318. NilPass:
  319.         send    "\nYour password: "
  320.         echo    off
  321.         input   $pass "\r"
  322.         echo    on
  323.         IF      $pass == "" then goto NilPass
  324.         timeout 300 goto bibi
  325.         send    "\n"
  326.         return
  327. LogSleep:
  328.         send    "\n\nLogon terminated after 2 minutes\n"
  329.         gosub   logout
  330.         goto    main
  331.  
  332. NewUser:
  333.         ascsend $dir"newuser"
  334. Newname:
  335.         send    "\n\nYour name: "
  336.         input   $name "\r"
  337.         send    "\n"$name" Correct? (y/N)"
  338.         input   $ok "\r"
  339.         IF      !$ok == "y" then goto Newname
  340. NewPassIn:
  341.         send    "\nYour password: "
  342.         echo    off
  343.         input   $pass "\r"
  344.         echo    on
  345.         send    "Once more... : "
  346.         echo    off
  347.         input   $pass1 "\r"
  348.         echo    on
  349.         if      $pass == $pass1 then goto NewPassOK
  350.         send    "\nSorry, line noice, enter password again\n"
  351.         goto    NewPassIn
  352. NewPassOk:
  353.         write   $userdir$name           $date"\n"
  354.         write   $userdir$name$pass      $date"\n"
  355.         write   $dir"User" $name" (Ordinary user)\n"
  356.         write   $dir"log" $date"\n\n  New User: "$name"\n"
  357.         timeout 300 goto bibi
  358.         send    "\n"
  359. ; Here is a questionare, its simple, but it should work...
  360. ;just add and delete questions as apropriate
  361.         send    "\nBefore you enter the BBS, I would like you to answer\n"
  362.         send    "the following questions:\n"
  363.         write   $userqst$name   $name
  364.         send    "\nAddress (2/4): "
  365.         input   $tmp "\r"
  366.         write   $userqst$name   $tmp"\n"
  367.         send    "\nAddress (3/4): "
  368.         input   $tmp "\r"
  369.         write   $userqst$name   $tmp"\n"
  370.         send    "\nAddress (4/4): "
  371.         input   $tmp "\r"
  372.         write   $userqst$name   $tmp"\n"
  373.         send    "\nComputer: "
  374.         input   $tmp "\r"
  375.         write   $userqst$name   $tmp"\n"
  376.         send    "\n\nThank you, I hope you enjoy it here!\n\n"
  377.         return
  378.  
  379. ;********************************************************
  380. ;Skip junk from the modem
  381. ;********************************************************
  382. skip:   timeout 3 goto SkipOK
  383. more:   wait    ""
  384.         goto more
  385. SkipOK: timeout 300 goto bibi
  386.         return
  387.  
  388.  
  389. ;********************************************************
  390. ;* Log out
  391. ;********************************************************
  392. logout: ;CLI     "fortune"
  393.         ascsend $dir"Logout"
  394.         hangup
  395.         write   $dir"log" $date"  Logout: "$name"\n"
  396.         CLI     "delete >nil: "$holdzoo" "$hold"#?"
  397.         write   $hold$sysname $sysname"\n Runs with version "$version"\n"
  398.         return
  399.  
  400. ;********************************************************
  401. ;* User sleeps
  402. ;********************************************************
  403. bibi:   send    "\n\nGood night!"
  404.         write   $dir"log" $date"  Sleep disconect\n"
  405.         gosub   logout
  406.         goto    main
  407.  
  408. ;********************************************************
  409. ;Main menu
  410. ;********************************************************
  411. MainMenu:
  412.         send    "\nCommand (? or ! for menu): "
  413.         input   $cmd "\r"
  414.         send    "\n"
  415.         IF $cmd == "?" THEN ascsend $menudir".menu0"
  416.         IF $cmd == "!" THEN ascsend $menudir"menu0"
  417.         IF $cmd == "G" THEN return
  418.         IF $cmd == "F" THEN gosub FileMenu
  419.         IF $cmd == "B" THEN gosub BullMenu
  420.         IF $cmd == "O" THEN gosub page
  421.         IF $cmd == "S" THEN gosub sysop
  422.         IF $cmd == "C" THEN gosub Comment
  423.         IF $cmd == "M" THEN gosub Messages
  424.         IF $cmd == "E" THEN gosub LetterMenu
  425.         IF $cmd == "P" THEN gosub ChangePasswd
  426.         IF $cmd == "L" THEN gosub ListUsers
  427.         IF $cmd == "V" THEN send "Version:"$version"\n"
  428.         goto    MainMenu
  429.  
  430.  
  431. ;********************************************************
  432. ;Chat with SYSOP
  433. ;********************************************************
  434. page:   send    "\Calling SYSOP...\n"
  435.         send    "(press Ctrl-Z to end the conversation)\n"
  436.         beep
  437.         dtenths 3
  438.         beep
  439.         dtenths 3
  440.         beep
  441.         write   $dir"log" $date"  Paged operator\n"
  442.         when    "^Z" goto EndChat
  443. chat:   input   $dummy  "\r"
  444.         send    "\n"
  445.         goto    chat
  446. EndChat:
  447.         dlwhen
  448.         send    "\n"
  449.         return
  450.  
  451. ;*********************************************
  452. ;Change Password
  453. ;*********************************************
  454.  
  455. ChangePasswd:
  456.  send   "\n\nWhat do you want to change your password to? (Enter to cancel) "
  457.         echo    off
  458.         input   $psw1 "\r"
  459.         if      $psw1 == "" then goto NoCHP
  460.         echo    on
  461.         send    "\nOne time more, thanks "
  462.         echo    off
  463.         input   $psw2 "\r"
  464.         echo    on
  465.         IF      !$psw1 == $psw2 THEN goto ChPErr
  466.     CLI "rename >nil: \""$userdir$name$pass"\" to \""$userdir$name$psw1"\""
  467.         IF      $CoSys == "TRUE" then goto CoSysopChpsw
  468.         IF      $SysAcc == "TRUE" then goto SysopChpsw
  469. ChaPsw: send    "\n\nPassword changed \n\n"
  470.         write   $dir"log" $date"  Changed passwd from "$pass" to "$psw1"\n"
  471.         SET     $pass = $psw1
  472.         return
  473. NoCHP:
  474.         echo    on
  475.         return
  476. ChPErr:
  477.         send    "\nSomething wrong there, try again.\n"
  478.         goto    ChangePasswd
  479. CoSysopChpsw:
  480.     CLI "rename >nil: \""$Cosysop$name$pass"\" to \""$Cosysop$name$psw1"\""
  481.         goto ChaPsw
  482. SysopChpsw:
  483.     CLI "rename >nil: \""$Sysop$name$pass"\" to \""$Sysop$name$psw1"\""
  484.         goto ChaPsw
  485.  
  486.  
  487. ;*******************************************************
  488. ;List users who have logged in
  489. ;*******************************************************
  490. ListUsers:
  491.         send    "\nUsers up to "$date"\n"
  492.         ascsend $dir"user"
  493.         write   $dir"log" $date"  Listed Users\n"
  494.         return
  495.  
  496. ;********************************************************
  497. ;File menu
  498. ;********************************************************
  499. FileMenu:
  500.         send    "\nFile command (? or ! for menu): "
  501.         input   $cmd "\r"
  502.         send    "\n"
  503.         IF $cmd == "?" THEN ascsend $menudir".menu1"
  504.         IF $cmd == "!" THEN ascsend $menudir"menu1"
  505.         IF $cmd == ""  THEN return
  506.         IF $cmd == "Q" THEN return
  507.         IF $cmd == "L" THEN gosub ListFiles
  508.         IF $cmd == "D" THEN gosub Download
  509.         IF $cmd == "U" THEN gosub Upload
  510.         IF $cmd == "V" THEN gosub ViewZOO
  511.         IF $cmd == "S" THEN gosub QListFiles
  512.         IF $cmd == "EXT" THEN gosub ExtractZOO
  513.         IF $cmd == "ADD" THEN gosub AddFile
  514.         IF $cmd == "DEL" THEN gosub Remove
  515.         IF $cmd == "DIR" THEN gosub Show
  516.         IF $cmd == "GET" THEN gosub GetHold
  517.         goto    FileMenu
  518.  
  519.  
  520. ;********************************************************
  521. ;List files in download directory
  522. ;********************************************************
  523. ListFiles:
  524.         send    "\n"
  525.         CLI     $list" "$dldir
  526.         return
  527.  
  528.  
  529. ;********************************************************
  530. ;List files in download directory quick
  531. ;********************************************************
  532. QListFiles:
  533.         send    "\n"
  534.         CLI     "C:ls "$dldir
  535.         return
  536.  
  537.  
  538. ;********************************************************
  539. ;Download file
  540. ;********************************************************
  541. Download:
  542.         IF EXISTS $UlDldir$name"UL" then goto DownlOK1
  543.         send    "\nNo files up, no files down....\n"
  544.         return
  545. DownlOK1:
  546.         send    "\nFilename: "
  547.         input   $file "\r"
  548.         send    "\n"
  549.         IF $file == "" THEN return
  550.         IF exists $dldir$file THEN goto DownlOK
  551.         send    "The file '"$file"' does not exist!\n"
  552.         return
  553. DownlOK:
  554.         send    "Choose protocol (B,G,X,Y,Z)\n"
  555.         send    "B=Ymodem Batch, G=Ymodem-G :"
  556.         input   $proto "\r"
  557.         send    "\n"
  558.         IF $proto == "" THEN return
  559.         IF $proto == "X" THEN goto XDownload
  560.         IF $proto == "Y" THEN goto YDownload
  561.         IF $proto == "Z" THEN goto ZDownload
  562.         IF $proto == "B" THEN goto BDownload
  563.         IF $proto == "G" THEN goto GDownload
  564.         send    "Illegal protocol!\n"
  565.         goto    DownlOK
  566. XDownload:
  567.         send    "Waiting...\n"
  568.         upload  $dldir$file,x
  569.         write   $dir"log" $date"  Downloaded "$file" (Xmodem)\n"
  570.         write   $UlDldir$name"DL" $file"\n"
  571.         return
  572. YDownload:
  573.         send    "Waiting...\n"
  574.         upload  $dldir$file,y
  575.         write   $dir"log" $date"  Downloaded "$file" (Ymodem)\n"
  576.         write   $UlDldir$name"DL" $file"\n"
  577.         return
  578. ZDownload:
  579.         send    "Waiting...\n"
  580.         upload  $dldir$file,z
  581.         write   $dir"log" $date"  Downloaded "$file" (Zmodem)\n"
  582.         write   $UlDldir$name"DL" $file"\n"
  583.         return
  584. BDownload:
  585.         send    "Waiting...\n"
  586.         upload  $dldir$file,b
  587.         write   $dir"log" $date"  Downloaded "$file" (Ymodem-Batch)\n"
  588.         write   $UlDldir$name"DL" $file"\n"
  589.         return
  590. GDownload:
  591.         IF      $hostMNPARQ == "FALSE" then goto NoGDL
  592.         send    "Waiting...\n"
  593.         upload  $dldir$file,g
  594.         write   $dir"log" $date"  Downloaded "$file" (Ymodem-G)\n"
  595.         write   $UlDldir$name"DL" $file"\n"
  596.         return
  597. NoGDL:
  598.         send    "\n\nThis BBS can't handle Ymodem-G, try another protocol\n"
  599.         goto    DownlOk
  600.  
  601. ;********************************************************
  602. ;Upload file
  603. ;********************************************************
  604. Upload:
  605.         send    "\nFilename: "
  606.         input   $file "\r"
  607.         send    "\n"
  608.         IF $file == "" THEN return
  609.         IF EXISTS $UlDldir$name"ULok" then goto ULOK
  610.         send    "\n\nSorry, you have no upload-credit..\n"
  611.         return
  612.         IF !EXISTS $uldir$file THEN goto UploadOK
  613.         send    "The file '"$file"' allready exists!\n"
  614.         return
  615. UploadOK:
  616.         send    "Describe the file: "
  617.         input   $desc "\r"
  618.         send    "\n"
  619. GetProto:
  620.         send    "Choose protocol (B,G,X,Y,Z)\n"
  621.         send    "B=Ymodem Batch, G=Ymodem-G: "
  622.         input   $proto "\r"
  623.         send    "\n"
  624.         IF $proto == "" THEN return
  625.         IF $proto == "X" THEN goto XUpload
  626.         IF $proto == "Y" THEN goto YUpload
  627.         IF $proto == "Z" THEN goto ZUpload
  628.         IF $proto == "B" THEN goto BUpload
  629.         IF $proto == "G" THEN goto GUpload
  630.         send    "Illegal protocol!\n"
  631.         goto    GetProto
  632. XUpload:
  633.         send    "Waiting...\n"
  634.         download $uldir$file,x
  635.         write   $dir"log" $date"  Uploaded "$file" (Xmodem)\n"
  636.         IF !$desc == "" THEN CLI "Filenote file "$uldir$file" comment \""$desc"\""
  637.         IF EXISTS $uldir$file THEN write $UlDldir$name"UL" $file"\n"
  638.         return
  639. YUpload:
  640.         send    "Waiting...\n"
  641.         download $uldir$file,y
  642.         write   $dir"log" $date"  Uploaded "$file" (Ymodem)\n"
  643.         IF !$desc == "" THEN CLI "Filenote file "$uldir$file" comment \""$desc"\""
  644.         IF EXISTS $uldir$file THEN write $UlDldir$name"UL" $file"\n"
  645.         return
  646. ZUpload:
  647.         send    "Waiting...\n"
  648.         download $uldir$file,z
  649.         write   $dir"log" $date"  Uploaded "$file" (Zmodem)\n"
  650.         IF !$desc == "" THEN CLI "Filenote file "$uldir$file" comment \""$desc"\""
  651.         IF EXISTS $uldir$file THEN write $UlDldir$name"UL" $file"\n"
  652.         return
  653. BUpload:
  654.         send    "Waiting...\n"
  655.         download $uldir$file,b
  656.         write   $dir"log" $date"  Uploaded "$file" (Ymodem-Batch)\n"
  657.         IF !$desc == "" THEN CLI "Filenote file "$uldir$file" comment \""$desc"\""
  658.         IF EXISTS $uldir$file THEN write $UlDldir$name"UL" $file"\n"
  659.         return
  660. GUpload:
  661.         IF      $hostMNPARQ == "FALSE" then goto NoGUL
  662.         send    "Waiting...\n"
  663.         download $uldir$file,g
  664.         write   $dir"log" $date"  Uploaded "$file" (Ymodem-g)\n"
  665.         IF !$desc == "" THEN CLI "Filenote file "$uldir$file" comment \""$desc"\""
  666.         IF EXISTS $uldir$file THEN write $UlDldir$name"UL" $file"\n"
  667.         return
  668. NoGUL:
  669.         send    "\n\nThis BBS can't handle Ymodem-G, try another protocol\n"
  670.         goto    GetProto
  671.  
  672. ;********************************************************
  673. ;Bulletin menu
  674. ;********************************************************
  675. BullMenu:
  676.         ascsend $menudir".menu2"
  677. bull:   send    "\nBulletin number (? or ! for menu): "
  678.         input   $cmd "\r"
  679.         send    "\n"
  680.         IF $cmd == "?"  THEN goto BullMenu
  681.         IF $cmd == "!"  THEN goto BullMe
  682.         IF $cmd == ""   THEN return
  683.         IF $cmd == "Q"  THEN return
  684.         IF exists $bulldir"bull"$cmd THEN goto ShowBull
  685.         send    "Illegal bulletin-number!\n"
  686.         goto    bull
  687. BullMe:
  688.         ascsend $menudir"menu2"
  689.         goto    bull
  690. ShowBull:
  691.         send    "\n"
  692.         ascsend $bulldir"bull"$cmd
  693.         write   $dir"log" $date"  Read bulletin #"$cmd"\n"
  694.         goto    bull
  695.  
  696.  
  697. ;********************************************************
  698. ;Sysop menu
  699. ;********************************************************
  700. SysopMenu:
  701.         ascsend $menudir"menu3"
  702. Sysop:
  703.         IF $sysacc == "TRUE" THEN goto SysOK
  704.         send    "Nope, you're not allowed!\n"
  705.         write   $dir"log" $date"  Attempted restricted command\n"
  706.         return
  707. SysOK:  send    "\nSysop Command (? for menu): "
  708.         input   $cmd "\r"
  709.         send    "\n"
  710.         IF $cmd == "?" THEN goto SysopMenu
  711.         IF $cmd == "Q" THEN return
  712.         IF $cmd == ""  THEN return
  713.         IF $cmd == "L" THEN goto ListLog
  714.         IF $cmd == "R" THEN goto Priv
  715.         IF $cmd == "D" THEN goto DeleteLog
  716.         IF $cmd == "C" THEN goto DeleteComm
  717.         IF $cmd == "B" THEN goto RemoteBackup
  718.         IF $cmd == "S" THEN goto StartScript
  719.  
  720. ;********************************************************
  721. ;Execute DOS command
  722. ;********************************************************
  723.         write   $dir"log" $date"  Executed DOS command: "$cmd"\n"
  724.         send    "\n Commands that can be executed from remote are:\n"
  725.         CLI     "C:ls "$doscomm
  726.         if      $local == "FALSE" then goto NoLocalDos
  727.         CLI     $cmd
  728.         goto sysok
  729. NoLocalDos:
  730.         CLI     $doscomm$cmd
  731.         goto sysok
  732.  
  733. NoDos:
  734.         send    "\n\nOnly available in local mode, sorry!!\n\n"
  735.         goto sysok
  736.         goto    sysok
  737.  
  738.  
  739. ;********************************************************
  740. ;Delete log file
  741. ;********************************************************
  742. DeleteLog:
  743.         if      $local == "FALSE" then goto NoDos
  744.         IF      $cosys == "TRUE" then goto sysok
  745.         send    "\nSäker (Enter=N)? "
  746.         input   $cmd "\r"
  747.         send    "\n"
  748.         IF !$cmd == "Y" THEN goto sysok
  749.         CLI     "delete "$dir"log"
  750.         write   $dir"log" $date"  Started new log\n"
  751.         goto sysok
  752.  
  753.  
  754. ;********************************************************
  755. ;Delete private messages
  756. ;********************************************************
  757. DeleteComm:
  758.         if      $local == "FALSE" then goto NoDos
  759.         IF      $cosys == "TRUE" then goto sysok
  760.         send    "\nDelete all private messages (Enter=N)? "
  761.         input   $cmd "\r"
  762.         send    "\n"
  763.         IF !$cmd == "Y" then goto sysok
  764.         CLI "delete >nil: "$msgsdir"Comments"
  765.         write   $dir"log" $date"  Private messages deleted\n"
  766.         goto sysok
  767.  
  768.  
  769. ;********************************************************
  770. ;List log file
  771. ;********************************************************
  772. ListLog:
  773.         send    "\n"
  774.         ascsend $dir"log"
  775.         write   $dir"log" $date"  Listed Log\n"
  776.         goto sysok
  777.  
  778.  
  779. ;********************************************************
  780. ;Remote Backup
  781. ;********************************************************
  782. RemoteBackup:
  783.         send    "\nRemote Backup started.\n"
  784.         CLI     "run >nil: <nil: copy ncomm:host to df1:host all clone"
  785.         write   $dir"log" $date"  Started Remote Backup\n"
  786.         goto sysok
  787.  
  788. ;********************************************************
  789. ;Start a script
  790. ;********************************************************
  791. StartScript:
  792.         Send    "\n\nThis is a Point of No Return!!!\n\n"
  793.         send    "When the script is started there is _NO WAY BACK_\n\n"
  794.         Send    "Continue? (Enter=N)"
  795.         input   $Cont "\r"
  796.         If      $cont == "Y" THEN GOTO StartS1
  797.         goto    sysok
  798. StartS1:
  799.         CHAIN   $dir"A.Script"
  800.  
  801. ;********************************************************
  802. ;Comment to sysop
  803. ;********************************************************
  804. Comment:
  805.         send    "\n\nSubject: "
  806.         input   $subject "\r"
  807.         IF $subject == "" then return
  808.         SET     $to = "Sysop"
  809.         SET     $mfile = "Comments"
  810.         SET     $mtype = "Comment to sysop"
  811.         goto    Writemess
  812.  
  813. ;********************************************************
  814. ;Messages menu
  815. ;********************************************************
  816. Messages:
  817.         ascsend $menudir".menu5"
  818. Mess1:  send    "\nMessage command (? or ! for menu): "
  819.         input   $cmd "\r"
  820.         send    "\n"
  821.         IF $cmd == "?"  THEN goto Messages
  822.         IF $cmd == "!"  THEN goto Mess2
  823.         IF $cmd == ""   THEN return
  824.         IF $cmd == "Q"  THEN return
  825.         IF $cmd == "R"  THEN goto Mess3
  826.         IF $cmd == "W"  THEN goto Mess3
  827.         GOTO    Mess1
  828. Mess3:
  829.         send    "\nArea number (? or ! for menu): "
  830.         input   $area "\r"
  831.         IF $area == "?"  THEN goto Mess3a
  832.         IF $area == "!" THEN goto Mess3b
  833.         send    "\n"
  834.         IF exists $msgsdir"messages"$area THEN goto Mess4
  835.         send    "Illegal Area-number!\n"
  836.         goto    Mess1
  837. Mess3a:
  838.         ascsend $menudir".menu5"
  839.         goto    Mess3
  840. Mess3b:
  841.         ascsend $menudir"menu5"
  842.         goto    Mess3
  843. Mess2:  ascsend $menudir"menu5"
  844.         goto    Mess1
  845. Mess4:  IF $cmd =="R"   THEN goto Read
  846.         gosub   Enter
  847.         goto    Mess1
  848.  
  849. ;********************************************************
  850. ;Enter message
  851. ;********************************************************
  852. Enter:
  853.         send    "\nTo (Enter=ALL): "
  854.         input   $to "\r"
  855.         IF $to == "" then SET $to = "ALL"
  856.         send    "\nSubject: "
  857.         input   $subject "\r"
  858.         IF $subject == "" then return
  859.         SET     $mfile = "messages"$area
  860.         SET     $mtype = "Area"$area
  861.         goto    Writemess
  862.  
  863.  
  864.  
  865. ;********************************************************
  866. ;Read public messages
  867. ;********************************************************
  868. Read:
  869.         ascsend $msgsdir"messages"$area
  870.         write   $dir"log" $date"  Read message in area "$area"\n"
  871.         goto    Mess1
  872.  
  873.  
  874. ;********************************************************
  875. ;Read private messages
  876. ;********************************************************
  877. Priv:   IF !EXISTS $msgsdir"comments" then goto sysok
  878.         ascsend $msgsdir"comments"
  879.         write   $dir"log" $date"  Read private messages.\n"
  880.         goto    sysok
  881.  
  882. ;********************************************************
  883. ;Handle NO CARRIER
  884. ;********************************************************
  885. NoCarrier:
  886.         write   $dir"log" $date"  CARRIER LOST\n"
  887.         gosub   logout
  888.         goto    main
  889.  
  890.  
  891. ;********************************************************
  892. ;View ZOO file
  893. ;********************************************************
  894. ViewZOO:
  895.         send    "\nGive the name of the  "$arch" file: "
  896.         input   $file "\r"
  897.         send    "\n"
  898.         IF $file == "" then return
  899.         IF exists $dldir$file then goto ViewOK
  900.         IF exists $dldir$file$arch then goto ViewOK
  901.         send    "The file does not exist!\n"
  902.         return
  903. ViewOK: write   $dir"log" $date" "$arch" view of "$file"\n"
  904.         CLI     $alist$dldir$file
  905.         return
  906.  
  907.  
  908. ;********************************************************
  909. ;Extract ZOO file
  910. ;********************************************************
  911. ExtractZOO:
  912.         IF EXISTS $UlDldir$name"UL" then goto ExtraZ1
  913.         send    "\nNo files up, no files down....\n"
  914.         return
  915. ExtraZ1:
  916.         send    "\nGive the name of the  "$arch" file: "
  917.         input   $file "\r"
  918.         send    "\n"
  919.         IF $file == "" then return
  920.         IF exists $dldir$file then goto ExtOK
  921.         IF exists $dldir$file$arch then goto ExtOK
  922.         send    "The file does not exist!\n"
  923.         return
  924. ExtOK:  send    "\nGive the name of the file(s) to extract [Enter=all]: "
  925.         input   $files "\r"
  926.         write   $dir"log" $date"  Extracted "$file" "$files"\n"
  927.         send    "\n"
  928.         CLI     "delete >nil: "$tmp
  929.         write   $tmp "CD "$hold"\n"
  930.         write   $tmp $aextract$dldir$file" "$files"\n"
  931.         CLI     "execute "$tmp
  932.         return
  933.  
  934.  
  935. ;********************************************************
  936. ;Add file to HOLD
  937. ;********************************************************
  938. AddFile:
  939.         IF EXISTS $UlDldir$name"UL" then goto AddF1
  940.         send    "\nNo files up, no files down....\n"
  941.         return
  942. AddF1:
  943.         send    "\nFilename: "
  944.         input   $file "\r"
  945.         send    "\n"
  946.         IF $file == "" then return
  947.         IF exists $dldir$file then goto AddOK
  948.         send    "The file '"$file"' does not exist!\n"
  949.         return
  950. AddOK:  CLI     "COPY "$dldir$file" "$hold
  951.         write   $dir"log" $date"  Added "$file"\n"
  952.         return
  953.  
  954.  
  955. ;********************************************************
  956. ;Delete file(s) from HOLD
  957. ;********************************************************
  958. Remove: send    "\nFilename: "
  959.         input   $file "\r"
  960.         send    "\n"
  961.         IF $file == "" then return
  962.         write   $dir"log" $date"  Deleted "$file"\n"
  963.         CLI     "delete \""$hold$file"\""
  964.         return
  965.  
  966.  
  967. ;********************************************************
  968. ;List files in HOLD directory
  969. ;********************************************************
  970. Show:
  971.         send    "\n"
  972.         CLI     $list" "$hold
  973.         return
  974.  
  975.  
  976. ;********************************************************
  977. ;Download files in HOLD directory
  978. ;********************************************************
  979. GetHold:
  980.         send    "Wait while I pack the files...\n"
  981.         CLI     "delete >nil: "$holdzoo
  982.         CLI     $apack$holdzoo" "$hold"*"
  983. GetPr:
  984.         send    "Choose protocol (B,G,X,Y,Z)\n"
  985.         send    "B=Ymodem Batch, G=Ymodem-G: "
  986.         input   $proto "\r"
  987.         send    "\n"
  988.         IF !$proto == "" THEN goto Get1
  989.         CLI     "delete >nil: "$holdzoo
  990.         return
  991. Get1:   IF $proto == "X" THEN goto XGet
  992.         IF $proto == "Y" THEN goto YGet
  993.         IF $proto == "Z" THEN goto ZGet
  994.         IF $proto == "B" THEN goto BGet
  995.         IF $proto == "G" THEN goto GGet
  996.         send    "Illegal protocol!\n"
  997.         goto    GetPr
  998. XGet:
  999.         send    "Waiting...\n"
  1000.         upload  $holdzoo,x
  1001.         write   $dir"log" $date"  Downloaded HOLD"$arch" (Xmodem)\n"
  1002.         write   $UlDldir$name"DL" "HOLD"$arch":\n"
  1003.         CLI     "list >>\""$UlDldir$name"DL\" "$hold" quick nohead"
  1004.         CLI     "delete >nil: "$holdzoo
  1005.         return
  1006. YGet:
  1007.         send    "Waiting...\n"
  1008.         upload  $holdzoo,y
  1009.         write   $dir"log" $date"  Downloaded HOLD"$arch" (Ymodem)\n"
  1010.         write   $UlDldir$name"DL" "HOLD"$arch":\n"
  1011.         CLI     "list >>\""$UlDldir$name"DL\" "$hold" quick nohead"
  1012.         CLI     "delete >nil: "$holdzoo
  1013.         return
  1014. ZGet:
  1015.         send    "Waiting...\n"
  1016.         upload  $holdzoo,z
  1017.         write   $dir"log" $date"  Downloaded HOLD"$arch" (Zmodem)\n"
  1018.         write   $UlDldir$name"DL" "HOLD"$arch":\n"
  1019.         CLI     "list >>\""$UlDldir$name"DL\" "$hold" quick nohead"
  1020.         CLI     "delete >nil: "$holdzoo
  1021.         return
  1022. BGet:
  1023.         send    "Waiting...\n"
  1024.         upload  $holdzoo,b
  1025.         write   $dir"log" $date"  Downloaded HOLD"$arch" (Ymodem-Batch)\n"
  1026.         write   $UlDldir$name"DL" "HOLD"$arch":\n"
  1027.         CLI     "list >>\""$UlDldir$name"DL\" "$hold" quick nohead"
  1028.         CLI     "delete >nil: "$holdzoo
  1029.         return
  1030. GGet:
  1031.         IF      $hostMNPARQ == "FALSE" then goto NoGGet
  1032.         send    "Waiting...\n"
  1033.         upload  $holdzoo,z
  1034.         write   $dir"log" $date"  Downloaded HOLD"$arch" (Ymodem-G)\n"
  1035.         write   $UlDldir$name"DL" "HOLD"$arch":\n"
  1036.         CLI     "list >>\""$UlDldir$name"DL\" "$hold" quick nohead"
  1037.         CLI     "delete >nil: "$holdzoo
  1038.         return
  1039. NoGGet:
  1040.         send    "\n\nThis BBS can't handle Ymodem-G, try another protocol\n"
  1041.         goto    GetPr
  1042.  
  1043. ;********************************************************
  1044. ;Letter menu, private mail
  1045. :********************************************************
  1046. LetterMenu:
  1047.         send    "\nLetter command (? or ! for menu): "
  1048.         input   $cmd "\r"
  1049.         send    "\n"
  1050.         IF $cmd == "?" THEN ascsend $menudir".menu4"
  1051.         IF $cmd == "!" THEN ascsend $menudir"menu4"
  1052.         IF $cmd == ""  THEN return
  1053.         IF $cmd == "Q" THEN return
  1054.         IF $cmd == "R" THEN gosub ReadLetter
  1055.         IF $cmd == "W" THEN gosub WriteLetter
  1056.         IF $cmd == "E" THEN gosub DeleteLetter
  1057.         IF $cmd == "G" THEN gosub GrabMail
  1058.         goto    LetterMenu
  1059.  
  1060. ;********************************************************
  1061. ;Enter message
  1062. ;********************************************************
  1063. WriteLetter:
  1064.         send    "\nTo: (enter to abort) "
  1065.         input   $to "\r"
  1066.         IF      $to == "" then return
  1067.         IF      EXISTS $userdir$to THEN goto WLCont
  1068.         send    "There is no user with the name "$to
  1069.         goto    WriteLetter
  1070. WLCont: send    "\nSubject: (enter to abort) "
  1071.         input   $subject "\r"
  1072.         IF      $subject == "" then return
  1073.         SET     $mtype = "Private"
  1074.         SET     $mfile = $to
  1075.         goto    writemess
  1076.  
  1077.  
  1078.  
  1079. ;********************************************************
  1080. ;Read private messages
  1081. ;********************************************************
  1082. ReadLetter:
  1083.         IF !EXISTS $msgsdir$name then goto NoLetter
  1084.         ascsend $msgsdir$name
  1085.         write   $dir"log" $date"  Read private letters \n"
  1086.         return
  1087. NoLetter:
  1088.         send "No private mail to "$name"\n"
  1089.         return
  1090.  
  1091. ;********************************************************
  1092. ;Delete private messages
  1093. ;********************************************************
  1094. DeleteLetter:
  1095.         send    "\nErase all private mail? (Enter=N) "
  1096.         input   $cmd "\r"
  1097.         send    "\n"
  1098.         IF !$cmd == "Y" then return
  1099.         CLI "delete >nil: \""$msgsdir$name"\""
  1100.         write   $dir"log" $date"  Private messages deleted\n"
  1101.         return
  1102.  
  1103.  
  1104. ;********************************************************
  1105. ;Grab all mail
  1106. ;********************************************************
  1107. GrabMail:
  1108.         CLI "copy >nil: \""$msgsdir$name"\" to \""$hold"\""
  1109.         send    "\n\nAdd messageareas (enter=Y) ?"
  1110.         input   $cmd "\r"
  1111.         send    "\n\n"
  1112.  if !$cmd == "N" then CLI "copy >nil: \""$msgsdir"messages#?\" to \""$hold"\""
  1113.         send    "\n\nAdd bulletins (enter=Y) ?"
  1114.         input   $cmd "\r"
  1115.         send    "\n\n"
  1116.  if !$cmd == "N" then CLI "copy >nil: \""$bulldir"bull#?\" to \""$hold"\""
  1117.         write   $dir"log" $date"  Fetched mail\n"
  1118.         goto    gethold
  1119.  
  1120. ;********************************************************
  1121. ;Enter message
  1122. ; $to           = to who
  1123. ; $mfile        = to wich file
  1124. ; $mtype        = type of message
  1125. ;********************************************************
  1126. WriteMess:
  1127.         CLI     "c:delete >NIL: RAM:__NHSX__TMP__"
  1128.         cli     "c:Copy >nil: \""$msgsdir$mfile"\" to RAM:__NHSX__TMP__"
  1129.         SET     $header = "\n\nFrom: "$name"\n"
  1130.         SET     $header = $header"To: "$to"\nSubject: "$subject"\n"
  1131.         SET     $header = $header"Date: "$date"\n"
  1132.         SET     $header = $header"-------------------------------\n"
  1133.         write   "RAM:__NHSX__TMP__" $header
  1134.         send    $header
  1135.         send    "[Write in your message below; "
  1136.         send    "end with Ctrl-Z on a blank line]\n\n"
  1137.         when    "^Z" goto endWL
  1138. WLent:  input   $line "\r"
  1139.         send    "\n"
  1140.         write   "RAM:__NHSX__TMP__" $line"\n"
  1141.         goto    WLent
  1142. EndWL:  dlwhen
  1143.         cli     "c:Copy >nil: RAM:__NHSX__TMP__ to \""$msgsdir$mfile"\""
  1144.         send    "\nMessage saved!^G\n"
  1145.         write   $dir"log" $date"  Entered "$mtype" message\n"
  1146.         return
  1147.  
  1148.  
  1149.